﻿using BusinessObjects;
using Domain.Abstract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebUI.Models;

namespace WebUI.Controllers
{
    public class SearchController : Controller
    {
        private IQuanHuyenRepository _quanHuyenRepository;
        private INhomNccRepository _nhomNccRepository;

        public SearchController(IQuanHuyenRepository quanHuyenRepository, INhomNccRepository nhomNccRepository)
        {
            _quanHuyenRepository = quanHuyenRepository;
            _nhomNccRepository = nhomNccRepository;
        }

        public ActionResult SearchNcc()
        {
            ViewBag.IdQuanHuyen = new SelectList(_quanHuyenRepository.QuanHuyens.OrderBy(x => x.Ten)
                                                    .Select(x => new
                                                                     {
                                                                         Value = x.Id,
                                                                         Text = x.Ten
                                                                     }), "Value", "Text");
            ViewBag.LstIdNhomNcc = new SelectList(_nhomNccRepository.NhomNccs.OrderBy(x => x.Ten)
                                                                                .Select(x => new
                                                                                                 {
                                                                                                     Value = x.Id,
                                                                                                     Text = x.Ten
                                                                                                 }), "Value", "Text");
            return PartialView(new NccSearchModel());
        }

    }
}
